/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 * No deletion without permission, or be held responsible to law.
 * @author ThinkGem
 */
import { defHttp } from '/@/utils/http/axios';
import { useGlobSetting } from '/@/hooks/setting';
import { BasicModel, Page } from '../../model/baseModel';
import { M8OrderPicFlowOver } from '../flow/flow';

const { adminPath } = useGlobSetting();

export interface M8OrderPic extends BasicModel<M8OrderPic> {
  picno?: string; // 图号
  picname?: string; // 图名
  cinvstd?: string; // 规格
  order?: any; // 订单
  flowList?: any[]; // 子表列表
}

export type Order = BasicModel<Order>;

export const overOrder = (params?: Order | any) =>
  defHttp.get<Order>({ url: adminPath + '/m8/order/overOrder', params });

export const updateFprice = (params?: Order | any) =>
  defHttp.post<Order>({ url: adminPath + '/m8/order/flow/updateFprice', params });

export const updateManager = (params?: Order | any) =>
  defHttp.post<Order>({ url: adminPath + '/m8/order/flow/updateManager', params });

export const updateHfDate = (params?: Order | any) =>
  defHttp.post<Order>({ url: adminPath + '/m8/order/flow/updateHfDate', params });

export const updateLastDate = (params?: Order | any) =>
  defHttp.post<Order>({ url: adminPath + '/m8/order/flow/updateLastDate', params });

export const fileList = (params?: any) =>
  defHttp.get<Order>({ url: adminPath + '/file/fileList', params });

export const clear = (params?: any) =>
  defHttp.get<Order>({ url: adminPath + '/m8/order/flow/clear', params });

export const overSave = (params?: any, data?: M8OrderPicFlowOver | any) =>
  defHttp.postJson<M8OrderPicFlowOver>({
    url: adminPath + '/m8/order/flow/over/save',
    params,
    data,
  });

export const batchSave = (params?: any) =>
  defHttp.post<M8OrderPicFlowOver>({ url: adminPath + '/m8/order/flow/over/batchSave', params });

export const orderSxDelete = (params?: Order | any) =>
  defHttp.get<Order>({ url: adminPath + '/m8/order/sx/delete', params });

export const orderSxForm = (params?: Order | any) =>
  defHttp.get<Order>({ url: adminPath + '/m8/order/sx/form', params });

export const orderSxUpdateFprice = (params?: Order | any) =>
  defHttp.get<Order>({ url: adminPath + '/m8/order/sx/updateFprice', params });

// 截止日期按钮接口
export const btnUpdateJzDate = (params?: Order | any) =>
  defHttp.post<Order>({ url: adminPath + '/m8/order/updateJzDate', params });

export const btnUpdateHfDate = (params?: Order | any) =>
  defHttp.get<Order>({ url: adminPath + '/m8/order/updateHfDate', params });

export const btnUpdateOrderStatus = (params?: Order | any) =>
  defHttp.post<Order>({ url: adminPath + '/m8/order/updateOrderStatus', params });

export const btnEnabelOrder = (params?: Order | any) =>
  defHttp.post<Order>({ url: adminPath + '/m8/order/enabelOrder', params });

export const btnUpdateYgOverDate = (params?: Order | any) =>
  defHttp.get<Order>({ url: adminPath + '/m8/order/updateYgOverDate', params });

export const moreSave = (params?: any) =>
  defHttp.post<Order>({ url: adminPath + '/m8/order/flow/more/save', params });

export const orderStatusList = (params?: any) =>
  defHttp.post<any>({
    url: adminPath + '/m8/order/orderStatusList',
    params,
  });

export const orderStatusDetailsList = (params?: any) =>
  defHttp.post<any>({
    url: adminPath + '/m8/order/orderStatusDetailsList',
    params,
  });

//修改订单紧急状态
export const changeStatus = (params?: Order | any) =>
  defHttp.post<Order>({ url: adminPath + '/m8/order/changeJJLevel', params });

export const orderDelete = (params?: Order | any) =>
  defHttp.get<Order>({ url: adminPath + '/m8/order/delete', params });

export const orderForm = (params?: Order | any) =>
  defHttp.get<Order>({ url: adminPath + '/m8/order/form', params });

export const orderEditForm = (params?: Order | any) =>
  defHttp.get<Order>({ url: adminPath + '/m8/order/editForm', params });

export const orderEditFormSave = (params?: any, data?: Order | any) =>
  defHttp.postJson<Order>({ url: adminPath + '/m8/order/editFormSave', params, data });

export const orderSave = (params?: any, data?: Order | any) =>
  defHttp.postJson<Order>({ url: adminPath + '/m8/order/save', params, data });

export const orderFlowListData = (params?: Order | any) =>
  defHttp.post<Page<Order>>({ url: adminPath + '/m8/order/flow/listData', params });

// 图纸信息

export const orderPicRrdListData = (params?: Order | any) =>
  defHttp.post<Page<Order>>({ url: adminPath + '/m8/order/pic/rdListData', params });

export const orderPicForm = (params?: Order | any) =>
  defHttp.get<Order>({ url: adminPath + '/m8/order/pic/form', params });

export const orderPicDelete = (params?: Order | any) =>
  defHttp.get<Order>({ url: adminPath + '/m8/order/pic/delete', params });

export const orderPicReadCopyData = (params?: Order | any) =>
  defHttp.post<Order>({ url: adminPath + '/m8/order/pic/readCopyData', params });

export const orderPicSave = (params?: any, data?: Order | any) =>
  defHttp.postJson<Order>({ url: adminPath + '/m8/order/pic/save', params, data });

export const orderPicSetXlSize = (params?: any, data?: Order | any) =>
  defHttp.postJson<Order>({ url: adminPath + '/m8/order/pic/setXlSize', params, data });

export const addRemarks = (params?: Order | any) =>
  defHttp.post<Order>({ url: adminPath + '/m8/order/pic/addRemarks', params });

export const bachEditPrice = (params?: Order | any) =>
  defHttp.post<Order>({ url: adminPath + '/m8/order/pic/bachEditPrice', params });

export const copyExcel = (params?: Order | any) =>
  defHttp.post<Order>({ url: adminPath + '/m8/order/pic/copyExcel', params });

export const findAllRemarks = (params?: Order | any) =>
  defHttp.get<Order>({ url: adminPath + '/m8/order/pic/findAllRemarks', params });

export const orderPicListData = (params?: M8OrderPic | any) =>
  defHttp.get<M8OrderPic>({ url: adminPath + '/m8/order/pic/listData', params });

export const orderPicPoListData = (params?: M8OrderPic | any) =>
  defHttp.get<M8OrderPic>({ url: adminPath + '/m8/order/pic/poListData', params });

//流程截止时间批量更新FORM
export const updateLastDateForm = (params?: M8OrderPic | any) =>
  defHttp.get<M8OrderPic>({ url: adminPath + '/m8/order/flow/updateLastDateForm', params });
//流程截止时间批量更新SAVE
export const updateLastDateSave = (params?: any, data?: M8OrderPic | any) =>
  defHttp.postJson<M8OrderPic>({
    url: adminPath + '/m8/order/flow/updateLastDate_batch',
    params,
    data,
  });

// 图纸打印
export const picPrintList = (params?: Order | any) =>
  defHttp.post<Page<Order>>({ url: adminPath + '/m8/order/pic/printList', params });

export const orderPicPrint = (params?: any, data?: Order | any) =>
  defHttp.postJson<Order>({ url: adminPath + '/m8/order/pic/getPicIds', params, data });
